<%@ page import="entity.User" %><%--
  Created by IntelliJ IDEA.
  User: User
  Date: 2024/5/15
  Time: 13:55
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
    <head>
        <title>主页</title>
    </head>
    <body>

        <%
            User user= (User) request.getSession().getAttribute("user");
            if(user==null){
                
        %>
        <a href="<%=request.getContextPath()%>/session/register.jsp">注册</a>
        <a href="<%=request.getContextPath()%>/session/login.jsp">登录</a>
        
        <%
            }else{
        %>
        <!--当用户已经成功登录了，则显示欢迎页面-->
        welcome,<%=user.getUsername()%>
        <a href="<%=request.getContextPath()%>/logout.code">注销</a>

        <%
            }
        %>

    </body>
</html>
